Skip to main content
IQK quants are a new quantization family developed specifically for ik_llama.cpp. They consistently outperform legacy and k-quants at equivalent bits per weight. Full details of the design are in Discussion 8 in the repository.

Available types

Standard IQK types

R4 variants (row-interleaved)

R4 types pack weights in an interleaved layout that improves CPU memory access patterns, giving better token-generation throughput on AVX2, Zen4, and ARM NEON. To use R4 packing at runtime without requantizing, pass the -rtr (--run-time-repack) flag. This repacks non-R4 tensors on load when an interleaved variant is available.

MXFP4

MXFP4, as used in gpt-oss models, is supported on Zen4, AVX2, ARM NEON, Metal, and CUDA.

Quantizing a model

1

Prepare a BF16 GGUF

Start from a BF16 base model. Quantizing from a higher-precision source gives the best results.
2

Generate an imatrix (recommended)

See the imatrix guide for the full command. An imatrix is not required but strongly recommended for quants below Q6_0.
3

Run llama-quantize

Custom quantization mixes

Real models are not uniform — attention tensors, embedding layers, and FFN experts often benefit from different quantization levels. Use --custom-q to apply per-tensor rules via regular expressions:
The base quant (IQ4_KS above) applies to all tensors not matched by any regex. Rules are evaluated in the order they are listed; the first match wins.

Dry run

Before running a full quantization, use --dry-run to preview which type each tensor will be assigned, without writing any output file:
Use --dry-run to iterate on your --custom-q patterns quickly before committing to a long quantization run.

Runtime repacking with -rtr

If you have a non-R4 model file but want R4 throughput on CPU, pass -rtr when starting the server or CLI:
ik_llama.cpp will repack tensors into the interleaved layout at load time when a corresponding R4 variant exists.